import request from '@/utils/request'

// 查询知识库文件列表
export function listFile(knowledgeId, query) {
  return request({
    url: '/knowledge-base/' + knowledgeId + '/files',
    method: 'get',
    params: query
  })
}

// 上传知识库文件
export function uploadFile(knowledgeId, file) {
  const formData = new FormData();
  formData.append('file', file);
  return request({
    url: '/knowledge-base/' + knowledgeId + '/files/upload',
    method: 'post',
    data: formData,
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  })
}

// 删除知识库文件
export function delFile(fileId) {
  return request({
    url: '/knowledge-base/0/files/' + fileId,
    method: 'delete'
  })
}

// 批量删除知识库文件
export function delFileByIds(fileIds) {
  return request({
    url: '/knowledge-base/0/files/batch',
    method: 'delete',
    data: fileIds
  })
}

// 处理知识库文件
export function processFile(fileId) {
  return request({
    url: '/knowledge-base/0/files/' + fileId + '/process',
    method: 'post'
  })
} 